﻿using GameServer.Model;
using Serilog;
using Summer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameServer.Mgr
{
    public class SpaceManager:Singleton<SpaceManager>
    {
        public Dictionary<int, Space> space_Dict = new Dictionary<int, Space>();
        public SpaceManager() { }
        public void Init()
        {
            foreach (var item in DataManager.Instance.SpaceDict)
            {
                space_Dict[item.Key] = new Space(item.Value);
                Log.Information("初始化地图:{0}",item.Value.Name);
            }
        }
        public Space GetSpace(int spaceId)
        {
            return space_Dict.GetValueOrDefault(spaceId,null);
        }
        public void Update()
        {
            foreach (var item in space_Dict.Values)
            {
                item.Update();
            }
        }
    }
}
